﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRM.DataAccess.Entities;
using CRM.Business.Services;
using CRM.Encryption;


namespace Web.Product
{
    public partial class AddNewSupplier : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
                return;
        }
        private int addNewSupplier()
        {
            PRODUCT_MANUFACTURER sup = new PRODUCT_MANUFACTURER();
            //sup.MANUFACTURER_NAME = txtSupplier.Text.Trim();
            return ProductService.AddNewSupplier(sup);
        }

        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            int newSupplier = addNewSupplier();
            if (newSupplier == 1)
            {
                string display = "Added new product successful !";
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);

            }
            else
            {
                string display = "Can not add new product !";
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);

            }
        }
    }
}